home *** CD-ROM | disk | FTP | other *** search
/ CD Actual Thematic 7: Programming / CDAT7.iso / Share / Codigo / hh / rsource.exe / Hexen Source / H2DEF.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-22  |  35.6 KB  |  1,460 lines

  1.  
  2. //**************************************************************************
  3. //**
  4. //** h2def.h : Heretic 2 : Raven Software, Corp.
  5. //**
  6. //** $RCSfile: h2def.h,v $
  7. //** $Revision: 1.128 $
  8. //** $Date: 96/01/16 10:35:31 $
  9. //** $Author: bgokey $
  10. //**
  11. //**************************************************************************
  12.  
  13. #ifndef __H2DEF__
  14. #define __H2DEF__
  15. #include <stdio.h>
  16. #include <string.h>
  17. #include <stdlib.h>
  18. #include "st_start.h"
  19. #ifdef __WATCOMC__
  20. #include <malloc.h>
  21. #define    strcasecmp strcmpi
  22. #define    strncasecmp strnicmp
  23. #endif
  24.  
  25. #define VERSION 110
  26. #define VERSION_TEXT "v1.1"
  27.  
  28. // Uncomment, to enable all timebomb stuff
  29. //#define TIMEBOMB
  30. #define TIMEBOMB_YEAR    95        // years since 1900
  31. #define TIMEBOMB_STARTDATE    268    // initial date (9/26)
  32. #define TIMEBOMB_ENDDATE    301    // end date (10/29)
  33.  
  34. // if rangecheck is undefined, most parameter validation debugging code
  35. // will not be compiled
  36. #ifndef NORANGECHECKING
  37. #define RANGECHECK
  38. #endif
  39.  
  40. // Past distributions
  41. #ifndef VER_ID
  42. #define VER_ID "DVL"
  43. #endif
  44. //#define VERSIONTEXT "ID V1.2"
  45. //#define VERSIONTEXT "RETAIL STORE BETA"        // 9/26/95
  46. //#define VERSIONTEXT "DVL BETA 10 05 95" // Used for GT for testing
  47. //#define VERSIONTEXT "DVL BETA 10 07 95" // Just an update for Romero
  48. //#define VERSIONTEXT "FINAL 1.0 (10 13 95)" // Just an update for Romero
  49. #ifdef RANGECHECK
  50. #define VERSIONTEXT "Version 1.1 +R "__DATE__" ("VER_ID")"
  51. #else
  52. #define VERSIONTEXT "Version 1.1 "__DATE__" ("VER_ID")"
  53. #endif
  54.  
  55. // all exterior data is defined here
  56. #include "xddefs.h"
  57.  
  58. // all important printed strings
  59. #include "textdefs.h"
  60.  
  61. // header generated by multigen utility
  62. #include "info.h"
  63.  
  64. extern byte *destview, *destscreen;    // PC direct to screen pointers
  65.  
  66. //
  67. // most key data are simple ascii (uppercased)
  68. //
  69. #define    KEY_RIGHTARROW        0xae
  70. #define    KEY_LEFTARROW        0xac
  71. #define    KEY_UPARROW            0xad
  72. #define    KEY_DOWNARROW        0xaf
  73. #define    KEY_ESCAPE            27
  74. #define    KEY_ENTER            13
  75. #define    KEY_F1                (0x80+0x3b)
  76. #define    KEY_F2                (0x80+0x3c)
  77. #define    KEY_F3                (0x80+0x3d)
  78. #define    KEY_F4                (0x80+0x3e)
  79. #define    KEY_F5                (0x80+0x3f)
  80. #define    KEY_F6                (0x80+0x40)
  81. #define    KEY_F7                (0x80+0x41)
  82. #define    KEY_F8                (0x80+0x42)
  83. #define    KEY_F9                (0x80+0x43)
  84. #define    KEY_F10                (0x80+0x44)
  85. #define    KEY_F11                (0x80+0x57)
  86. #define    KEY_F12                (0x80+0x58)
  87.  
  88. #define    KEY_BACKSPACE        127
  89. #define    KEY_PAUSE            0xff
  90.  
  91. #define KEY_EQUALS            0x3d
  92. #define KEY_MINUS            0x2d
  93.  
  94. #define    KEY_RSHIFT            (0x80+0x36)
  95. #define    KEY_RCTRL            (0x80+0x1d)
  96. #define    KEY_RALT            (0x80+0x38)
  97.  
  98. #define    KEY_LALT            KEY_RALT
  99.  
  100. #define KEY_FIVE            0x35
  101. #define KEY_SIX                0x36
  102. #define KEY_SEVEN            0x37
  103. #define KEY_EIGHT            0x38
  104. #define KEY_NINE            0x39
  105. #define KEY_ZERO            0x30
  106. #define KEY_BACKSLASH        0x5C
  107.  
  108.  
  109. #define MAXCHAR ((char)0x7f)
  110. #define MAXSHORT ((short)0x7fff)
  111. #define MAXINT    ((int)0x7fffffff)    /* max pos 32-bit int */
  112. #define MAXLONG ((long)0x7fffffff)
  113.  
  114. #define MINCHAR ((char)0x80)
  115. #define MINSHORT ((short)0x8000)
  116. #define MININT     ((int)0x80000000)    /* max negative 32-bit integer */
  117. #define MINLONG ((long)0x80000000)
  118.  
  119. #define    FINEANGLES            8192
  120. #define    FINEMASK            (FINEANGLES-1)
  121. #define    ANGLETOFINESHIFT    19    // 0x100000000 to 0x2000
  122.  
  123. /*
  124. ===============================================================================
  125.  
  126.                         GLOBAL TYPES
  127.  
  128. ===============================================================================
  129. */
  130.  
  131. //#define NUMARTIFCTS    28
  132. #define MAXPLAYERS    8
  133. #define TICRATE        35            // number of tics / second
  134. #define TICSPERSEC    35
  135.  
  136. #define MINIMUM_HEAP_SIZE    0x800000        //  8 meg
  137. #define MAXIMUM_HEAP_SIZE    0x2000000        // 32 meg
  138.  
  139. #define    FRACBITS        16
  140. #define    FRACUNIT        (1<<FRACBITS)
  141. typedef int fixed_t;
  142.  
  143. typedef unsigned int uint;
  144.  
  145. //#define ANGLE_1        0x01000000
  146. #define ANGLE_45    0x20000000
  147. #define ANGLE_90    0x40000000
  148. #define ANGLE_180    0x80000000
  149. #define ANGLE_MAX    0xffffffff
  150. #define ANGLE_1        (ANGLE_45/45)
  151. #define ANGLE_60    (ANGLE_180/3)
  152.  
  153. #define    ANG45    0x20000000
  154. #define    ANG90    0x40000000
  155. #define    ANG180    0x80000000
  156. #define    ANG270    0xc0000000
  157.  
  158. typedef unsigned angle_t;
  159.  
  160. typedef enum
  161. {
  162.     sk_baby,
  163.     sk_easy,
  164.     sk_medium,
  165.     sk_hard,
  166.     sk_nightmare
  167. } skill_t;
  168.  
  169. typedef enum
  170. {
  171.     ev_keydown,
  172.     ev_keyup,
  173.     ev_mouse,
  174.     ev_joystick
  175. } evtype_t;
  176.  
  177. typedef struct
  178. {
  179.     evtype_t    type;
  180.     int            data1;        // keys / mouse/joystick buttons
  181.     int            data2;        // mouse/joystick x move
  182.     int            data3;        // mouse/joystick y move
  183. } event_t;
  184.  
  185. typedef struct
  186. {
  187.     char        forwardmove;        // *2048 for move
  188.     char        sidemove;            // *2048 for move
  189.     short        angleturn;            // <<16 for angle delta
  190.     short        consistancy;        // checks for net game
  191.     byte        chatchar;
  192.     byte        buttons;
  193.     byte        lookfly;            // look/fly up/down/centering
  194.     byte        arti;                // artitype_t to use
  195. } ticcmd_t;
  196.  
  197. #define    BT_ATTACK        1
  198. #define    BT_USE            2
  199. #define    BT_CHANGE        4            // if true, the next 3 bits hold weapon num
  200. #define    BT_WEAPONMASK    (8+16+32)
  201. #define    BT_WEAPONSHIFT    3
  202.  
  203. #define BT_SPECIAL        128            // game events, not really buttons
  204. #define    BTS_SAVEMASK    (4+8+16)
  205. #define    BTS_SAVESHIFT    2
  206. #define    BT_SPECIALMASK    3
  207. #define    BTS_PAUSE        1            // pause the game
  208. #define    BTS_SAVEGAME    2            // save the game at each console
  209. // savegame slot numbers occupy the second byte of buttons
  210.  
  211. // The top 3 bits of the artifact field in the ticcmd_t struct are used
  212. //         as additional flags 
  213. #define AFLAG_MASK            0x3F
  214. #define AFLAG_SUICIDE        0x40
  215. #define AFLAG_JUMP            0x80
  216.  
  217. typedef enum
  218. {
  219.     GS_LEVEL,
  220.     GS_INTERMISSION,
  221.     GS_FINALE,
  222.     GS_DEMOSCREEN
  223. } gamestate_t;
  224.  
  225. typedef enum
  226. {
  227.     ga_nothing,
  228.     ga_loadlevel,
  229.     ga_initnew,
  230.     ga_newgame,
  231.     ga_loadgame,
  232.     ga_savegame,
  233.     ga_playdemo,
  234.     ga_completed,
  235.     ga_leavemap,
  236.     ga_singlereborn,
  237.     ga_victory,
  238.     ga_worlddone,
  239.     ga_screenshot
  240. } gameaction_t;
  241.  
  242. typedef enum
  243. {
  244.     wipe_0,
  245.     wipe_1,
  246.     wipe_2,
  247.     wipe_3,
  248.     wipe_4,
  249.     NUMWIPES,
  250.     wipe_random
  251. } wipe_t;
  252.  
  253. /*
  254. ===============================================================================
  255.  
  256.                             MAPOBJ DATA
  257.  
  258. ===============================================================================
  259. */
  260.  
  261. // think_t is a function pointer to a routine to handle an actor
  262. typedef void (*think_t) ();
  263.  
  264. typedef struct thinker_s
  265. {
  266.     struct        thinker_s    *prev, *next;
  267.     think_t        function;
  268. } thinker_t;
  269.  
  270. struct player_s;
  271.  
  272. typedef struct mobj_s
  273. {
  274.     thinker_t        thinker;            // thinker node
  275.  
  276. // info for drawing
  277.     fixed_t            x,y,z;
  278.     struct    mobj_s    *snext, *sprev;        // links in sector (if needed)
  279.     angle_t            angle;
  280.     spritenum_t        sprite;                // used to find patch_t and flip value
  281.     int                frame;                // might be ord with FF_FULLBRIGHT
  282.  
  283. // interaction info
  284.     struct mobj_s    *bnext, *bprev;        // links in blocks (if needed)
  285.     struct subsector_s    *subsector;
  286.     fixed_t            floorz, ceilingz;    // closest together of contacted secs
  287.     fixed_t            floorpic;            // contacted sec floorpic
  288.     fixed_t            radius, height;        // for movement checking
  289.     fixed_t            momx, momy, momz;    // momentums
  290.     int                validcount;            // if == validcount, already checked
  291.     mobjtype_t        type;
  292.     mobjinfo_t        *info;                // &mobjinfo[mobj->type]
  293.     int                tics;                // state tic counter
  294.     state_t            *state;
  295.     int                damage;            // For missiles
  296.     int                flags;
  297.     int                flags2;            // Heretic flags
  298.     int                special1;        // Special info
  299.     int                special2;        // Special info
  300.     int                health;
  301.     int                movedir;        // 0-7
  302.     int                movecount;        // when 0, select a new dir
  303.     struct mobj_s    *target;        // thing being chased/attacked (or NULL)
  304.                                     // also the originator for missiles
  305.     int                reactiontime;    // if non 0, don't attack yet
  306.                                     // used by player to freeze a bit after
  307.                                     // teleporting
  308.     int                threshold;        // if > 0, the target will be chased
  309.                                     // no matter what (even if shot)
  310.     struct player_s    *player;        // only valid if type == MT_PLAYER
  311.     int                lastlook;        // player number last looked for
  312.     fixed_t            floorclip;        // value to use for floor clipping
  313.     int                archiveNum;        // Identity during archive
  314.     short            tid;            // thing identifier
  315.     byte            special;        // special
  316.     byte            args[5];        // special arguments
  317. } mobj_t;
  318.  
  319. // each sector has a degenmobj_t in it's center for sound origin purposes
  320. typedef struct
  321. {
  322.     thinker_t        thinker;        // not used for anything
  323.     fixed_t            x,y,z;
  324. } degenmobj_t;
  325.  
  326. // Most damage defined using HITDICE
  327. #define HITDICE(a) ((1+(P_Random()&7))*a)
  328.  
  329. //
  330. // frame flags
  331. //
  332. #define    FF_FULLBRIGHT    0x8000        // flag in thing->frame
  333. #define FF_FRAMEMASK    0x7fff
  334.  
  335. // --- mobj.flags ---
  336.  
  337. #define    MF_SPECIAL        1            // call P_SpecialThing when touched
  338. #define    MF_SOLID        2
  339. #define    MF_SHOOTABLE    4
  340. #define    MF_NOSECTOR        8            // don't use the sector links
  341.                                     // (invisible but touchable)
  342. #define    MF_NOBLOCKMAP    16            // don't use the blocklinks
  343.                                     // (inert but displayable)
  344. #define    MF_AMBUSH        32
  345. #define    MF_JUSTHIT        64            // try to attack right back
  346. #define    MF_JUSTATTACKED    128            // take at least one step before attacking
  347. #define    MF_SPAWNCEILING    256            // hang from ceiling instead of floor
  348. #define    MF_NOGRAVITY    512            // don't apply gravity every tic
  349.  
  350. // movement flags
  351. #define    MF_DROPOFF        0x400        // allow jumps from high places
  352. #define    MF_PICKUP        0x800        // for players to pick up items
  353. #define    MF_NOCLIP        0x1000        // player cheat
  354. #define    MF_SLIDE        0x2000        // keep info about sliding along walls
  355. #define    MF_FLOAT        0x4000        // allow moves to any height, no gravity
  356. #define    MF_TELEPORT        0x8000        // don't cross lines or look at heights
  357. #define MF_MISSILE        0x10000        // don't hit same species, explode on block
  358.  
  359. #define    MF_ALTSHADOW    0x20000        // alternate fuzzy draw
  360. #define    MF_SHADOW        0x40000        // use fuzzy draw (shadow demons / invis)
  361. #define    MF_NOBLOOD        0x80000        // don't bleed when shot (use puff)
  362. #define    MF_CORPSE        0x100000    // don't stop moving halfway off a step
  363. #define    MF_INFLOAT        0x200000    // floating to a height for a move, don't
  364.                                     // auto float to target's height
  365.  
  366. #define    MF_COUNTKILL    0x400000    // count towards intermission kill total
  367. #define    MF_ICECORPSE    0x800000    // a frozen corpse (for blasting)
  368.  
  369. #define    MF_SKULLFLY        0x1000000    // skull in flight
  370. #define    MF_NOTDMATCH    0x2000000    // don't spawn in death match (key cards)
  371.  
  372. //#define    MF_TRANSLATION    0xc000000    // if 0x4 0x8 or 0xc, use a translation
  373. #define    MF_TRANSLATION    0x1c000000    // use a translation table (>>MF_TRANSHIFT)
  374. #define    MF_TRANSSHIFT    26            // table for player colormaps
  375.  
  376.  
  377. // --- mobj.flags2 ---
  378.  
  379. #define MF2_LOGRAV            0x00000001    // alternate gravity setting
  380. #define MF2_WINDTHRUST        0x00000002    // gets pushed around by the wind
  381.                                         // specials
  382. #define MF2_FLOORBOUNCE        0x00000004    // bounces off the floor
  383. #define MF2_BLASTED            0x00000008    // missile will pass through ghosts
  384. #define MF2_FLY                0x00000010    // fly mode is active
  385. #define MF2_FLOORCLIP        0x00000020    // if feet are allowed to be clipped
  386. #define MF2_SPAWNFLOAT        0x00000040    // spawn random float z
  387. #define MF2_NOTELEPORT        0x00000080    // does not teleport
  388. #define MF2_RIP                0x00000100    // missile rips through solid
  389.                                         // targets
  390. #define MF2_PUSHABLE        0x00000200    // can be pushed by other moving
  391.                                         // mobjs
  392. #define MF2_SLIDE            0x00000400    // slides against walls
  393. #define MF2_ONMOBJ            0x00000800    // mobj is resting on top of another
  394.                                         // mobj
  395. #define MF2_PASSMOBJ        0x00001000    // Enable z block checking.  If on,
  396.                                         // this flag will allow the mobj to
  397.                                         // pass over/under other mobjs.
  398. #define MF2_CANNOTPUSH        0x00002000    // cannot push other pushable mobjs
  399. #define MF2_DROPPED            0x00004000    // dropped by a demon
  400. #define MF2_BOSS            0x00008000    // mobj is a major boss
  401. #define MF2_FIREDAMAGE        0x00010000    // does fire damage
  402. #define MF2_NODMGTHRUST        0x00020000    // does not thrust target when
  403.                                         // damaging
  404. #define MF2_TELESTOMP        0x00040000    // mobj can stomp another
  405. #define MF2_FLOATBOB        0x00080000    // use float bobbing z movement
  406. #define MF2_DONTDRAW        0x00100000    // don't generate a vissprite
  407. #define MF2_IMPACT            0x00200000     // an MF_MISSILE mobj can activate
  408.                                          // SPAC_IMPACT
  409. #define MF2_PUSHWALL        0x00400000     // mobj can push walls
  410. #define MF2_MCROSS            0x00800000    // can activate monster cross lines
  411. #define MF2_PCROSS            0x01000000    // can activate projectile cross lines
  412. #define MF2_CANTLEAVEFLOORPIC 0x02000000 // stay within a certain floor type
  413. #define MF2_NONSHOOTABLE    0x04000000    // mobj is totally non-shootable, 
  414.                                         // but still considered solid
  415. #define MF2_INVULNERABLE    0x08000000    // mobj is invulnerable
  416. #define MF2_DORMANT            0x10000000    // thing is dormant
  417. #define MF2_ICEDAMAGE        0x20000000  // does ice damage
  418. #define MF2_SEEKERMISSILE    0x40000000    // is a seeker (for reflection)
  419. #define MF2_REFLECTIVE        0x80000000    // reflects missiles
  420.  
  421. //=============================================================================
  422.  
  423. // ===== Player Class Types =====
  424. typedef enum
  425. {
  426.     PCLASS_FIGHTER,
  427.     PCLASS_CLERIC,
  428.     PCLASS_MAGE,
  429.     PCLASS_PIG,
  430.     NUMCLASSES
  431. } pclass_t;
  432.  
  433. typedef enum
  434. {
  435.     PST_LIVE,            // playing
  436.     PST_DEAD,            // dead on the ground
  437.     PST_REBORN            // ready to restart
  438. } playerstate_t;
  439.  
  440. // psprites are scaled shapes directly on the view screen
  441. // coordinates are given for a 320*200 view screen
  442. typedef enum
  443. {
  444.     ps_weapon,
  445.     ps_flash,
  446.     NUMPSPRITES
  447. } psprnum_t;
  448.  
  449. typedef struct
  450. {
  451.     state_t    *state;        // a NULL state means not active
  452.     int        tics;
  453.     fixed_t    sx, sy;
  454. } pspdef_t;
  455.  
  456. /* Old Heretic key type
  457. typedef enum
  458. {
  459.     key_yellow,
  460.     key_green,
  461.     key_blue,
  462.     NUMKEYS
  463. } keytype_t;
  464. */
  465.  
  466. typedef enum
  467. {
  468.     KEY_1,
  469.     KEY_2,
  470.     KEY_3,
  471.     KEY_4,
  472.     KEY_5,
  473.     KEY_6,
  474.     KEY_7,
  475.     KEY_8,
  476.     KEY_9,
  477.     KEY_A,
  478.     KEY_B,
  479.     NUMKEYS
  480. } keytype_t;
  481.  
  482. typedef enum
  483. {
  484.     ARMOR_ARMOR,
  485.     ARMOR_SHIELD,
  486.     ARMOR_HELMET,
  487.     ARMOR_AMULET,
  488.     NUMARMOR
  489. } armortype_t;
  490.  
  491. typedef enum
  492. {
  493.     WP_FIRST,
  494.     WP_SECOND,
  495.     WP_THIRD,
  496.     WP_FOURTH,
  497.     NUMWEAPONS,
  498.     WP_NOCHANGE
  499. } weapontype_t;
  500.     
  501. typedef enum
  502. {
  503.     MANA_1,
  504.     MANA_2,
  505.     NUMMANA,
  506.     MANA_BOTH,
  507.     MANA_NONE
  508. } manatype_t;
  509.  
  510. #define MAX_MANA    200
  511.  
  512. #define WPIECE1        1
  513. #define WPIECE2        2
  514. #define WPIECE3        4
  515.  
  516. typedef struct
  517. {
  518.     manatype_t mana;
  519.     int upstate;
  520.     int downstate;
  521.     int readystate;
  522.     int atkstate;
  523.     int holdatkstate;
  524.     int flashstate;
  525. } weaponinfo_t;
  526.  
  527. extern weaponinfo_t WeaponInfo[NUMWEAPONS][NUMCLASSES];
  528.  
  529. typedef enum
  530. {
  531.     arti_none,
  532.     arti_invulnerability,
  533.     arti_health,
  534.     arti_superhealth,
  535.     arti_healingradius,
  536.     arti_summon,
  537.     arti_torch,
  538.     arti_egg,
  539.     arti_fly,
  540.     arti_blastradius,
  541.     arti_poisonbag,
  542.     arti_teleportother,
  543.     arti_speed,
  544.     arti_boostmana,
  545.     arti_boostarmor,
  546.     arti_teleport,
  547.     // Puzzle artifacts
  548.     arti_firstpuzzitem,
  549.     arti_puzzskull = arti_firstpuzzitem,
  550.     arti_puzzgembig,
  551.     arti_puzzgemred,
  552.     arti_puzzgemgreen1,
  553.     arti_puzzgemgreen2,
  554.     arti_puzzgemblue1,
  555.     arti_puzzgemblue2,
  556.     arti_puzzbook1,
  557.     arti_puzzbook2,
  558.     arti_puzzskull2,
  559.     arti_puzzfweapon,
  560.     arti_puzzcweapon,
  561.     arti_puzzmweapon,
  562.     arti_puzzgear1,
  563.     arti_puzzgear2,
  564.     arti_puzzgear3,
  565.     arti_puzzgear4,
  566.     NUMARTIFACTS
  567. } artitype_t;
  568.  
  569. typedef enum
  570. {
  571.     pw_None,
  572.     pw_invulnerability,
  573.     pw_allmap,
  574.     pw_infrared,
  575.     pw_flight,
  576.     pw_shield,
  577.     pw_health2,
  578.     pw_speed,
  579.     pw_minotaur,
  580.     NUMPOWERS
  581. } powertype_t;
  582.  
  583. #define    INVULNTICS (30*35)
  584. #define    INVISTICS (60*35)
  585. #define    INFRATICS (120*35)
  586. #define    IRONTICS (60*35)
  587. #define WPNLEV2TICS (40*35)
  588. #define FLIGHTTICS (60*35)
  589. #define SPEEDTICS (45*35)
  590. #define MORPHTICS (40*35)
  591. #define MAULATORTICS (25*35)
  592.  
  593. #define MESSAGETICS (4*35)
  594. #define BLINKTHRESHOLD (4*35)
  595.  
  596. #define NUMINVENTORYSLOTS    NUMARTIFACTS
  597.  
  598. typedef struct
  599. {
  600.     int type;
  601.     int count;
  602. } inventory_t;
  603.  
  604. /*
  605. ================
  606. =
  607. = player_t
  608. =
  609. ================
  610. */
  611.  
  612. typedef struct player_s
  613. {
  614.     mobj_t *mo;
  615.     playerstate_t playerstate;
  616.     ticcmd_t cmd;
  617.  
  618.     pclass_t    class;                    // player class type
  619.  
  620.     fixed_t        viewz;                    // focal origin above r.z
  621.     fixed_t        viewheight;                // base height above floor for viewz
  622.     fixed_t        deltaviewheight;        // squat speed
  623.     fixed_t        bob;                    // bounded/scaled total momentum
  624.  
  625.     int            flyheight;
  626.     int            lookdir;
  627.     boolean        centering;
  628.     int            health;                    // only used between levels, mo->health
  629.                                         // is used during levels
  630.     int    armorpoints[NUMARMOR];
  631.  
  632.     inventory_t    inventory[NUMINVENTORYSLOTS];
  633.     artitype_t    readyArtifact;
  634.     int            artifactCount;
  635.     int         inventorySlotNum;
  636.     int            powers[NUMPOWERS];
  637.     int            keys;
  638.     int            pieces;                    // Fourth Weapon pieces
  639.     signed int            frags[MAXPLAYERS];        // kills of other players
  640.     weapontype_t    readyweapon;
  641.     weapontype_t    pendingweapon;        // wp_nochange if not changing
  642.     boolean        weaponowned[NUMWEAPONS];
  643.     int            mana[NUMMANA];
  644.     int            attackdown, usedown;    // true if button down last tic
  645.     int            cheats;                    // bit flags
  646.  
  647.     int            refire;                    // refired shots are less accurate
  648.  
  649.     int            killcount, itemcount, secretcount;        // for intermission
  650.     char        message[80];            // hint messages
  651.     int            messageTics;            // counter for showing messages
  652.     short        ultimateMessage;
  653.     short        yellowMessage;
  654.     int            damagecount, bonuscount;// for screen flashing
  655.     int            poisoncount;            // screen flash for poison damage
  656.     mobj_t        *poisoner;                // NULL for non-player mobjs
  657.     mobj_t        *attacker;                // who did damage (NULL for floors)
  658.     int            extralight;                // so gun flashes light up areas
  659.     int            fixedcolormap;            // can be set to REDCOLORMAP, etc
  660.     int            colormap;                // 0-3 for which color to draw player
  661.     pspdef_t    psprites[NUMPSPRITES];    // view sprites (gun, etc)
  662.     int            morphTics;                // player is a pig if > 0
  663.     uint        jumpTics;                // delay the next jump for a moment
  664.     unsigned int worldTimer;            // total time the player's been playing
  665. } player_t;
  666.  
  667. #define CF_NOCLIP        1
  668. #define    CF_GODMODE        2
  669. #define    CF_NOMOMENTUM    4 // not really a cheat, just a debug aid
  670.  
  671.  
  672. #define        BACKUPTICS        12
  673.  
  674. typedef struct
  675. {
  676.     unsigned    checksum;                    // high bit is retransmit request
  677.     byte        retransmitfrom;                // only valid if NCMD_RETRANSMIT
  678.     byte        starttic;
  679.     byte        player, numtics;
  680.     ticcmd_t    cmds[BACKUPTICS];
  681. } doomdata_t;
  682.  
  683. typedef struct
  684. {
  685.     long    id;
  686.     short    intnum;            // DOOM executes an int to execute commands
  687.  
  688. // communication between DOOM and the driver
  689.     short    command;        // CMD_SEND or CMD_GET
  690.     short    remotenode;        // dest for send, set by get (-1 = no packet)
  691.     short    datalength;        // bytes in doomdata to be sent
  692.  
  693. // info common to all nodes
  694.     short    numnodes;        // console is allways node 0
  695.     short    ticdup;            // 1 = no duplication, 2-5 = dup for slow nets
  696.     short    extratics;        // 1 = send a backup tic in every packet
  697.     short    deathmatch;        // 1 = deathmatch
  698.     short    savegame;        // -1 = new game, 0-5 = load savegame
  699.     short    episode;        // 1-3
  700.     short    map;            // 1-9
  701.     short    skill;            // 1-5
  702.  
  703. // info specific to this node
  704.     short    consoleplayer;
  705.     short    numplayers;
  706.     short    angleoffset;    // 1 = left, 0 = center, -1 = right
  707.     short    drone;            // 1 = drone
  708.  
  709. // packet data to be sent
  710.     doomdata_t    data;
  711. } doomcom_t;
  712.  
  713. #define    DOOMCOM_ID        0x12345678l
  714.  
  715. extern    doomcom_t        *doomcom;
  716. extern    doomdata_t        *netbuffer;        // points inside doomcom
  717.  
  718. #define    MAXNETNODES        16            // max computers in a game
  719.  
  720. #define    CMD_SEND    1
  721. #define    CMD_GET        2
  722. #define CMD_FRAG    3
  723.  
  724. #define    SBARHEIGHT    39            // status bar height at bottom of screen
  725.  
  726. void NET_SendFrags(player_t *player);
  727.  
  728. /*
  729. ===============================================================================
  730.  
  731.                     GLOBAL VARIABLES
  732.  
  733. ===============================================================================
  734. */
  735.  
  736. #define TELEFOGHEIGHT (32*FRACUNIT)
  737.  
  738. #define MAXEVENTS 64
  739.  
  740. extern event_t events[MAXEVENTS];
  741. extern int eventhead;
  742. extern int eventtail;
  743.  
  744. extern fixed_t finesine[5*FINEANGLES/4];
  745. extern fixed_t *finecosine;
  746.  
  747. extern gameaction_t gameaction;
  748.  
  749. extern boolean paused;
  750.  
  751. extern boolean shareware; // true if other episodes not present
  752.  
  753. extern boolean DevMaps; // true = map development mode
  754. extern char *DevMapsDir; // development maps directory
  755.  
  756. extern boolean nomonsters; // checkparm of -nomonsters
  757.  
  758. extern boolean respawnparm; // checkparm of -respawn
  759.  
  760. extern boolean randomclass; // checkparm of -randclass
  761.  
  762. extern boolean debugmode; // checkparm of -debug
  763.  
  764. extern boolean usergame; // ok to save / end game
  765.  
  766. extern boolean ravpic; // checkparm of -ravpic
  767.  
  768. extern boolean altpal; // checkparm to use an alternate palette routine
  769.  
  770. extern boolean cdrom; // true if cd-rom mode active ("-cdrom")
  771.  
  772. extern boolean deathmatch; // only if started as net death
  773.  
  774. extern boolean netgame; // only true if >1 player
  775.  
  776. extern boolean cmdfrag; // true if a CMD_FRAG packet should be sent out every
  777.                         // kill
  778.  
  779. extern boolean playeringame[MAXPLAYERS];
  780. extern pclass_t PlayerClass[MAXPLAYERS];
  781.  
  782. extern int consoleplayer; // player taking events and displaying
  783.  
  784. extern int displayplayer;
  785.  
  786. extern int viewangleoffset;    // ANG90 = left side, ANG270 = right
  787.  
  788. extern player_t players[MAXPLAYERS];
  789.  
  790. extern    boolean        singletics;            // debug flag to cancel adaptiveness
  791.  
  792. extern boolean DebugSound; // debug flag for displaying sound info
  793.  
  794. extern boolean demoplayback;
  795. extern int maxzone;                // Maximum chunk allocated for zone heap
  796.  
  797. extern int Sky1Texture;
  798. extern int Sky2Texture;
  799.  
  800. extern    gamestate_t    gamestate;
  801. extern    skill_t        gameskill;
  802. //extern    boolean        respawnmonsters;
  803. extern    int            gameepisode;
  804. extern    int            gamemap;
  805. extern     int             prevmap;
  806. extern    int            levelstarttic;        // gametic at level start
  807. extern    int            leveltime;            // tics in game play for par
  808.  
  809. extern    ticcmd_t    netcmds[MAXPLAYERS][BACKUPTICS];
  810. extern int ticdup;
  811.  
  812. //#define    MAXNETNODES        8
  813.  
  814. extern    ticcmd_t        localcmds[BACKUPTICS];
  815. extern int rndindex;
  816. extern int gametic, maketic;
  817. extern    int            nettics[MAXNETNODES];
  818.  
  819. #define MAXDEATHMATCHSTARTS 16
  820. extern mapthing_t *deathmatch_p;
  821. extern mapthing_t deathmatchstarts[MAXDEATHMATCHSTARTS];
  822.  
  823. // Position indicator for cooperative net-play reborn
  824. extern int RebornPosition;
  825.  
  826. #define MAX_PLAYER_STARTS 8
  827. extern mapthing_t playerstarts[MAX_PLAYER_STARTS][MAXPLAYERS];
  828.  
  829. extern int viewwindowx;
  830. extern int viewwindowy;
  831. extern int viewwidth;
  832. extern int scaledviewwidth;
  833. extern int viewheight;
  834.  
  835. extern int mouseSensitivity;
  836.  
  837. extern boolean precache; // if true, load all graphics at level load
  838.  
  839. extern byte *screen; // off screen work buffer, from V_video.c
  840.  
  841. extern boolean singledemo; // quit after playing a demo from cmdline
  842.  
  843. extern FILE *debugfile;
  844. extern int bodyqueslot;
  845. extern skill_t startskill;
  846. extern int startepisode;
  847. extern int startmap;
  848. extern boolean autostart;
  849.  
  850. /*
  851. ===============================================================================
  852.  
  853.                     GLOBAL FUNCTIONS
  854.  
  855. ===============================================================================
  856. */
  857.  
  858.  
  859. fixed_t    FixedMul (fixed_t a, fixed_t b);
  860. fixed_t    FixedDiv (fixed_t a, fixed_t b);
  861. fixed_t    FixedDiv2 (fixed_t a, fixed_t b);
  862.  
  863. #ifdef __WATCOMC__
  864. #pragma aux FixedMul =    \
  865.     "imul ebx",            \
  866.     "shrd eax,edx,16"    \
  867.     parm    [eax] [ebx] \
  868.     value    [eax]        \
  869.     modify exact [eax edx]
  870.  
  871. #pragma aux FixedDiv2 =    \
  872.     "cdq",                \
  873.     "shld edx,eax,16",    \
  874.     "sal eax,16",        \
  875.     "idiv ebx"            \
  876.     parm    [eax] [ebx] \
  877.     value    [eax]        \
  878.     modify exact [eax edx]
  879. #endif
  880.  
  881. #ifdef __BIG_ENDIAN__
  882. short ShortSwap(short);
  883. long LongSwap(long);
  884. #define SHORT(x)    ShortSwap(x)
  885. #define LONG(x)        LongSwap(x)
  886. #else
  887. #define SHORT(x)    (x)
  888. #define LONG(x)        (x)
  889. #endif
  890.  
  891.  
  892. //-----------
  893. //MEMORY ZONE
  894. //-----------
  895. // tags < 100 are not overwritten until freed
  896. #define    PU_STATIC        1            // static entire execution time
  897. #define    PU_SOUND        2            // static while playing
  898. #define    PU_MUSIC        3            // static while playing
  899. #define    PU_DAVE            4            // anything else Dave wants static
  900. #define    PU_LEVEL        50            // static until level exited
  901. #define    PU_LEVSPEC        51            // a special thinker in a level
  902. // tags >= 100 are purgable whenever needed
  903. #define    PU_PURGELEVEL    100
  904. #define    PU_CACHE        101
  905.  
  906.  
  907. void    Z_Init (void);
  908. void     *Z_Malloc (int size, int tag, void *ptr);
  909. void     Z_Free (void *ptr);
  910. void     Z_FreeTags (int lowtag, int hightag);
  911. //void     Z_DumpHeap (int lowtag, int hightag);
  912. //void    Z_FileDumpHeap (FILE *f);
  913. void    Z_CheckHeap (void);
  914. void    Z_ChangeTag2 (void *ptr, int tag);
  915. //int     Z_FreeMemory (void);
  916.  
  917. typedef struct memblock_s
  918. {
  919.     int                     size;           // including the header and possibly tiny fragments
  920.     void            **user;         // NULL if a free block
  921.     int                     tag;            // purgelevel
  922.     int                     id;                     // should be ZONEID
  923.     struct memblock_s       *next, *prev;
  924. } memblock_t;
  925.  
  926. #define Z_ChangeTag(p,t) \
  927. { \
  928. if (( (memblock_t *)( (byte *)(p) - sizeof(memblock_t)))->id!=0x1d4a11) \
  929.     I_Error("Z_CT at "__FILE__":%i",__LINE__); \
  930. Z_ChangeTag2(p,t); \
  931. };
  932.  
  933. //-------
  934. //WADFILE
  935. //-------
  936. typedef struct
  937. {
  938.     char        name[8];
  939.     int            handle,position,size;
  940. } lumpinfo_t;
  941.  
  942. extern lumpinfo_t *lumpinfo;
  943. extern int numlumps;
  944.  
  945. void W_InitMultipleFiles(char **filenames);
  946. void W_OpenAuxiliary(char *filename);
  947. void W_CloseAuxiliaryFile(void);
  948. void W_CloseAuxiliary(void);
  949. void W_UsePrimary(void);
  950. void W_UseAuxiliary(void);
  951. int W_CheckNumForName(char *name);
  952. int W_GetNumForName(char *name);
  953. int W_LumpLength(int lump);
  954. void W_ReadLump(int lump, void *dest);
  955. void *W_CacheLumpNum(int lump, int tag);
  956. void *W_CacheLumpName(char *name, int tag);
  957.  
  958. //----------
  959. //BASE LEVEL
  960. //----------
  961. void H2_Main(void);
  962. // not a globally visible function, just included for source reference
  963. // calls all startup code
  964. // parses command line options
  965. // if not overrided, calls N_AdvanceDemo
  966.  
  967. void H2_GameLoop(void);
  968. // not a globally visible function, just included for source reference
  969. // called by H2_Main, never exits
  970. // manages timing and IO
  971. // calls all ?_Responder, ?_Ticker, and ?_Drawer functions
  972. // calls I_GetTime, I_StartFrame, and I_StartTic
  973.  
  974. void H2_PostEvent(event_t *ev);
  975. // called by IO functions when input is detected
  976.  
  977. void NetUpdate (void);
  978. // create any new ticcmds and broadcast to other players
  979.  
  980. void D_QuitNetGame (void);
  981. // broadcasts special packets to other players to notify of game exit
  982.  
  983. void TryRunTics (void);
  984.  
  985. //---------
  986. //SYSTEM IO
  987. //---------
  988. #if 1
  989. #define    SCREENWIDTH        320
  990. #define    SCREENHEIGHT    200
  991. #else
  992. #define    SCREENWIDTH        560
  993. #define    SCREENHEIGHT    375
  994. #endif
  995.  
  996. byte *I_ZoneBase (int *size);
  997. // called by startup code to get the ammount of memory to malloc
  998. // for the zone management
  999.  
  1000. int I_GetTime (void);
  1001. // called by H2_GameLoop
  1002. // returns current time in tics
  1003.  
  1004. void I_StartFrame (void);
  1005. // called by H2_GameLoop
  1006. // called before processing any tics in a frame (just after displaying a frame)
  1007. // time consuming syncronous operations are performed here (joystick reading)
  1008. // can call H2_PostEvent
  1009.  
  1010. void I_StartTic (void);
  1011. // called by H2_GameLoop
  1012. // called before processing each tic in a frame
  1013. // quick syncronous operations are performed here
  1014. // can call H2_PostEvent
  1015.  
  1016. // asyncronous interrupt functions should maintain private ques that are
  1017. // read by the syncronous functions to be converted into events
  1018.  
  1019. void I_Init (void);
  1020. // called by H2_Main
  1021. // determines the hardware configuration and sets up the video mode
  1022.  
  1023. void I_InitGraphics (void);
  1024.  
  1025. void I_InitNetwork (void);
  1026. void I_NetCmd (void);
  1027.  
  1028. void I_CheckExternDriver(void);
  1029.  
  1030. void I_Error (char *error, ...);
  1031. // called by anything that can generate a terminal error
  1032. // bad exit with diagnostic message
  1033.  
  1034. void I_Quit (void);
  1035. // called by M_Responder when quit is selected
  1036. // clean exit, displays sell blurb
  1037.  
  1038. void I_SetPalette (byte *palette);
  1039. // takes full 8 bit values
  1040.  
  1041. void I_Update(void);
  1042. // Copy buffer to video
  1043.  
  1044. void I_WipeUpdate(wipe_t wipe);
  1045. // Copy buffer to video with wipe effect
  1046.  
  1047. void I_WaitVBL(int count);
  1048. // wait for vertical retrace or pause a bit
  1049.  
  1050. void I_BeginRead (void);
  1051. void I_EndRead (void);
  1052.  
  1053. byte    *I_AllocLow (int length);
  1054. // allocates from low memory under dos, just mallocs under unix
  1055.  
  1056. void I_Tactile (int on, int off, int total);
  1057.  
  1058. #ifdef __WATCOMC__
  1059. extern boolean useexterndriver;
  1060.  
  1061. #define EBT_FIRE            1
  1062. #define EBT_OPENDOOR         2
  1063. #define EBT_SPEED            4
  1064. #define EBT_STRAFE            8
  1065. #define EBT_MAP                0x10
  1066. #define EBT_INVENTORYLEFT     0x20
  1067. #define EBT_INVENTORYRIGHT     0x40
  1068. #define EBT_USEARTIFACT        0x80
  1069. #define EBT_FLYDROP            0x100
  1070. #define EBT_CENTERVIEW        0x200
  1071. #define EBT_PAUSE            0x400
  1072. #define EBT_WEAPONCYCLE        0x800
  1073. #define EBT_JUMP            0x1000
  1074.  
  1075. typedef struct
  1076. {
  1077.     short vector; // Interrupt vector
  1078.     
  1079.     signed char moveForward; // forward/backward (maxes at 50)
  1080.     signed char moveSideways; // strafe (maxes at 24)
  1081.     short angleTurn; // turning speed (640 [slow] 1280 [fast])
  1082.     short angleHead; // head angle (+2080 [left] : 0 [center] : -2048 [right])
  1083.     signed char pitch; // look up/down (-110 : +90)
  1084.     signed char flyDirection; // flyheight (+1/-1)
  1085.     unsigned short buttons; // EBT_* flags
  1086. } externdata_t;
  1087. #endif
  1088.  
  1089. //----
  1090. //GAME
  1091. //----
  1092.  
  1093. void G_DeathMatchSpawnPlayer (int playernum);
  1094.  
  1095. void G_InitNew (skill_t skill, int episode, int map);
  1096.  
  1097. void G_DeferedInitNew (skill_t skill, int episode, int map);
  1098. // can be called by the startup code or M_Responder
  1099. // a normal game starts at map 1, but a warp test can start elsewhere
  1100.  
  1101. void G_DeferredNewGame(skill_t skill);
  1102.  
  1103. void G_DeferedPlayDemo (char *demo);
  1104.  
  1105. void G_LoadGame(int slot);
  1106. // can be called by the startup code or M_Responder
  1107. // calls P_SetupLevel or W_EnterWorld
  1108. void G_DoLoadGame (void);
  1109.  
  1110. void G_SaveGame (int slot, char *description);
  1111. // called by M_Responder
  1112.  
  1113. void G_RecordDemo (skill_t skill, int numplayers, int episode
  1114.     , int map, char *name);
  1115. // only called by startup code
  1116.  
  1117. void G_PlayDemo (char *name);
  1118. void G_TimeDemo (char *name);
  1119.  
  1120. void G_TeleportNewMap(int map, int position);
  1121.  
  1122. void G_Completed(int map, int position);
  1123. //void G_ExitLevel (void);
  1124. //void G_SecretExitLevel (void);
  1125.  
  1126. void G_StartNewGame(skill_t skill);
  1127. void G_StartNewInit(void);
  1128.  
  1129. void G_WorldDone (void);
  1130.  
  1131. void G_Ticker (void);
  1132. boolean G_Responder (event_t *ev);
  1133.  
  1134. void G_ScreenShot (void);
  1135.  
  1136. //-------
  1137. //SV_SAVE
  1138. //-------
  1139.  
  1140. #define HXS_VERSION_TEXT "HXS Ver 2.37"
  1141. #define HXS_VERSION_TEXT_LENGTH 16
  1142. #define HXS_DESCRIPTION_LENGTH 24
  1143.  
  1144. void SV_SaveGame(int slot, char *description);
  1145. void SV_SaveMap(boolean savePlayers);
  1146. void SV_LoadGame(int slot);
  1147. void SV_MapTeleport(int map, int position);
  1148. void SV_LoadMap(void);
  1149. void SV_InitBaseSlot(void);
  1150. void SV_UpdateRebornSlot(void);
  1151. void SV_ClearRebornSlot(void);
  1152. boolean SV_RebornSlotAvailable(void);
  1153. int SV_GetRebornSlot(void);
  1154.  
  1155. //-----
  1156. //PLAY
  1157. //-----
  1158.  
  1159. void P_Ticker (void);
  1160. // called by C_Ticker
  1161. // can call G_PlayerExited
  1162. // carries out all thinking of monsters and players
  1163.  
  1164. void P_SetupLevel (int episode, int map, int playermask, skill_t skill);
  1165. // called by W_Ticker
  1166.  
  1167. void P_Init (void);
  1168. // called by startup code
  1169.  
  1170. int P_GetMapCluster(int map);
  1171. int P_TranslateMap(int map);
  1172. int P_GetMapCDTrack(int map);
  1173. int P_GetMapWarpTrans(int map);
  1174. int P_GetMapNextMap(int map);
  1175. int P_GetMapSky1Texture(int map);
  1176. int P_GetMapSky2Texture(int map);
  1177. char *P_GetMapName(int map);
  1178. fixed_t P_GetMapSky1ScrollDelta(int map);
  1179. fixed_t P_GetMapSky2ScrollDelta(int map);
  1180. boolean P_GetMapDoubleSky(int map);
  1181. boolean P_GetMapLightning(int map);
  1182. boolean P_GetMapFadeTable(int map);
  1183. char *P_GetMapSongLump(int map);
  1184. void P_PutMapSongLump(int map, char *lumpName);
  1185. int P_GetCDStartTrack(void);
  1186. int P_GetCDEnd1Track(void);
  1187. int P_GetCDEnd2Track(void);
  1188. int P_GetCDEnd3Track(void);
  1189. int P_GetCDIntermissionTrack(void);
  1190. int P_GetCDTitleTrack(void);
  1191.  
  1192. //-------
  1193. //REFRESH
  1194. //-------
  1195.  
  1196. extern boolean setsizeneeded;
  1197.  
  1198. extern boolean BorderNeedRefresh;
  1199. extern boolean BorderTopRefresh;
  1200.  
  1201. extern int UpdateState;
  1202. // define the different areas for the dirty map
  1203. #define I_NOUPDATE    0
  1204. #define I_FULLVIEW    1
  1205. #define I_STATBAR    2
  1206. #define I_MESSAGES    4
  1207. #define I_FULLSCRN    8
  1208.  
  1209. void R_RenderPlayerView (player_t *player);
  1210. // called by G_Drawer
  1211.  
  1212. void R_Init (void);
  1213. // called by startup code
  1214.  
  1215. void R_DrawViewBorder (void);
  1216. void R_DrawTopBorder (void);
  1217. // if the view size is not full screen, draws a border around it
  1218.  
  1219. void R_SetViewSize (int blocks, int detail);
  1220. // called by M_Responder
  1221.  
  1222. int    R_FlatNumForName (char *name);
  1223.  
  1224. int    R_TextureNumForName (char *name);
  1225. int    R_CheckTextureNumForName (char *name);
  1226. // called by P_Ticker for switches and animations
  1227. // returns the texture number for the texture name
  1228.  
  1229.  
  1230. //----
  1231. //MISC
  1232. //----
  1233. extern    int        myargc;
  1234. extern    char    **myargv;
  1235. extern    int        localQuakeHappening[MAXPLAYERS];
  1236.  
  1237. int    M_CheckParm(char *check);
  1238. // returns the position of the given parameter in the arg list (0 if not found)
  1239. boolean M_ParmExists(char *check);
  1240.  
  1241. void M_ExtractFileBase(char *path, char *dest);
  1242.  
  1243. void M_ForceUppercase(char *text);
  1244. // Changes a string to uppercase
  1245.  
  1246. int M_Random (void);
  1247. // returns a number from 0 to 255
  1248.  
  1249. extern unsigned char rndtable[256];
  1250. extern int prndindex;
  1251. #define P_Random() rndtable[(++prndindex)&0xff]
  1252. // as M_Random, but used only by the play simulation
  1253.  
  1254. void M_ClearRandom (void);
  1255. // fix randoms for demos
  1256.  
  1257. void M_FindResponseFile(void);
  1258.  
  1259. void M_ClearBox (fixed_t *box);
  1260. void M_AddToBox (fixed_t *box, fixed_t x, fixed_t y);
  1261. // bounding box functions
  1262.  
  1263. boolean M_WriteFile(char const *name, void *source, int length);
  1264. int M_ReadFile(char const *name, byte **buffer);
  1265. int M_ReadFileCLib(char const *name, byte **buffer);
  1266.  
  1267. void M_ScreenShot (void);
  1268.  
  1269. void M_LoadDefaults(char *fileName);
  1270.  
  1271. void M_SaveDefaults (void);
  1272.  
  1273. int M_DrawText (int x, int y, boolean direct, char *string);
  1274.  
  1275. //------------------------------
  1276. // SC_man.c
  1277. //------------------------------
  1278.  
  1279. void SC_Open(char *name);
  1280. void SC_OpenLump(char *name);
  1281. void SC_OpenFile(char *name);
  1282. void SC_OpenFileCLib(char *name);
  1283. void SC_Close(void);
  1284. boolean SC_GetString(void);
  1285. void SC_MustGetString(void);
  1286. void SC_MustGetStringName(char *name);
  1287. boolean SC_GetNumber(void);
  1288. void SC_MustGetNumber(void);
  1289. void SC_UnGet(void);
  1290. //boolean SC_Check(void);
  1291. boolean SC_Compare(char *text);
  1292. int SC_MatchString(char **strings);
  1293. int SC_MustMatchString(char **strings);
  1294. void SC_ScriptError(char *message);
  1295.  
  1296. extern char *sc_String;
  1297. extern int sc_Number;
  1298. extern int sc_Line;
  1299. extern boolean sc_End;
  1300. extern boolean sc_Crossed;
  1301. extern boolean sc_FileScripts;
  1302. extern char *sc_ScriptsDir;
  1303.  
  1304. //------------------------------
  1305. // SN_sonix.c
  1306. //------------------------------
  1307.  
  1308. enum
  1309. {
  1310.     SEQ_PLATFORM,
  1311.     SEQ_PLATFORM_HEAVY,        // same script as a normal platform
  1312.     SEQ_PLATFORM_METAL,
  1313.     SEQ_PLATFORM_CREAK,        // same script as a normal platform
  1314.     SEQ_PLATFORM_SILENCE,
  1315.     SEQ_PLATFORM_LAVA,
  1316.     SEQ_PLATFORM_WATER,
  1317.     SEQ_PLATFORM_ICE,
  1318.     SEQ_PLATFORM_EARTH,
  1319.     SEQ_PLATFORM_METAL2,
  1320.     SEQ_DOOR_STONE,
  1321.     SEQ_DOOR_HEAVY,
  1322.     SEQ_DOOR_METAL,
  1323.     SEQ_DOOR_CREAK,
  1324.     SEQ_DOOR_SILENCE,
  1325.     SEQ_DOOR_LAVA,
  1326.     SEQ_DOOR_WATER,
  1327.     SEQ_DOOR_ICE,
  1328.     SEQ_DOOR_EARTH,
  1329.     SEQ_DOOR_METAL2,
  1330.     SEQ_ESOUND_WIND,
  1331.     SEQ_NUMSEQ
  1332. };
  1333.  
  1334. typedef enum
  1335. {
  1336.     SEQTYPE_STONE,
  1337.     SEQTYPE_HEAVY,
  1338.     SEQTYPE_METAL,
  1339.     SEQTYPE_CREAK,
  1340.     SEQTYPE_SILENCE,
  1341.     SEQTYPE_LAVA,
  1342.     SEQTYPE_WATER,
  1343.     SEQTYPE_ICE,
  1344.     SEQTYPE_EARTH,
  1345.     SEQTYPE_METAL2,
  1346.     SEQTYPE_NUMSEQ
  1347. } seqtype_t;
  1348.  
  1349. void SN_InitSequenceScript(void);
  1350. void SN_StartSequence(mobj_t *mobj, int sequence);
  1351. void SN_StartSequenceName(mobj_t *mobj, char *name);
  1352. void SN_StopSequence(mobj_t *mobj);
  1353. void SN_UpdateActiveSequences(void);
  1354. void SN_StopAllSequences(void);
  1355. int SN_GetSequenceOffset(int sequence, int *sequencePtr);
  1356. void SN_ChangeNodeData(int nodeNum, int seqOffset, int delayTics, int volume,
  1357.     int currentSoundID);
  1358.  
  1359.  
  1360. typedef struct seqnode_s seqnode_t;
  1361. struct seqnode_s
  1362. {
  1363.     int *sequencePtr;
  1364.     int    sequence;
  1365.     mobj_t *mobj;
  1366.     int currentSoundID;
  1367.     int delayTics;
  1368.     int volume;
  1369.     int stopSound;
  1370.     seqnode_t *prev;
  1371.     seqnode_t *next;
  1372. };
  1373.  
  1374. extern int ActiveSequences;
  1375. extern seqnode_t *SequenceListHead;
  1376.  
  1377. //----------------------
  1378. // Interlude (IN_lude.c)
  1379. //----------------------
  1380.  
  1381. #define MAX_INTRMSN_MESSAGE_SIZE 1024
  1382.  
  1383. extern boolean intermission;
  1384. extern char ClusterMessage[MAX_INTRMSN_MESSAGE_SIZE];
  1385.  
  1386. void IN_Start(void);
  1387. void IN_Ticker(void);
  1388. void IN_Drawer(void);
  1389.  
  1390. //----------------------
  1391. // Chat mode (CT_chat.c)
  1392. //----------------------
  1393.  
  1394. void CT_Init(void);
  1395. void CT_Drawer(void);
  1396. boolean CT_Responder(event_t *ev);
  1397. void CT_Ticker(void);
  1398. char CT_dequeueChatChar(void);
  1399.  
  1400. extern boolean chatmodeon;
  1401.  
  1402. //--------------------
  1403. // Finale (F_finale.c)
  1404. //--------------------
  1405.  
  1406. void F_Drawer(void);
  1407. void F_Ticker(void);
  1408. void F_StartFinale(void);
  1409.  
  1410. //----------------------
  1411. // STATUS BAR (SB_bar.c)
  1412. //----------------------
  1413.  
  1414. extern int inv_ptr;
  1415. extern int curpos;
  1416. extern int SB_state;
  1417. void SB_Init(void);
  1418. void SB_SetClassData(void);
  1419. boolean SB_Responder(event_t *event);
  1420. void SB_Ticker(void);
  1421. void SB_Drawer(void);
  1422. void Draw_TeleportIcon(void);
  1423. void Draw_SaveIcon(void);
  1424. void Draw_LoadIcon(void);
  1425.  
  1426. //-----------------
  1427. // MENU (MN_menu.c)
  1428. //-----------------
  1429.  
  1430. void MN_Init(void);
  1431. void MN_ActivateMenu(void);
  1432. void MN_DeactivateMenu(void);
  1433. boolean MN_Responder(event_t *event);
  1434. void MN_Ticker(void);
  1435. void MN_Drawer(void);
  1436. void MN_DrTextA(char *text, int x, int y);
  1437. void MN_DrTextAYellow(char *text, int x, int y);
  1438. int MN_TextAWidth(char *text);
  1439. void MN_DrTextB(char *text, int x, int y);
  1440. int MN_TextBWidth(char *text);
  1441.  
  1442. //------
  1443. // VIDEO
  1444. //------
  1445.  
  1446. extern int dirtybox[4];
  1447. extern byte gammatable[5][256];
  1448. extern int usegamma;
  1449.  
  1450. void V_Init(void); // Allocates buffer screens, call before R_Init
  1451. void V_DrawPatch(int x, int y, patch_t *patch);
  1452. void V_DrawFuzzPatch(int x, int y, patch_t *patch);
  1453. void V_DrawAltFuzzPatch(int x, int y, patch_t *patch);
  1454. void V_DrawShadowedPatch(int x, int y, patch_t *patch);
  1455. void V_DrawRawScreen(byte *raw);
  1456.  
  1457. #include "sounds.h"
  1458.  
  1459. #endif // __H2DEF__
  1460.